package com.jky.stmall.exercise;

public class myThread implements Runnable{
    @Override
    public void run() {
        synchronized (this) {
            for (int i = 0; i < 10; i++) {
                System.out.println("main" + i);
            }
        }
    }
    public static void main(String[] args) {
        /*myThread m=new myThread();
        myThread k=new myThread();

        new Thread(m).start();
        new Thread(k).start();*/
        /*Thread t=new Thread();
        for (int i =0;i<20;i++){
            System.out.println(Thread.currentThread().getName()+i);
        }*/
        System.out.println("----------");
        myThread s=new myThread();
        Thread t1=new Thread(s);
        Thread t2=new Thread(s);
        t1.start();
        t2.start();

    }
}
